/*
 * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
 *
 * Author:     fanpengcheng <fanpengcheng_cm@deepin.com>
 *
 * Maintainer: fanpengcheng <fanpengcheng_cm@deepin.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <DIconButton>
#include <DMainWindow>
#include <DListView>

#include <QVector>
#include <QMainWindow>
#include <QPaintEvent>
#include <QStandardItemModel>
#include <QHBoxLayout>

DWIDGET_USE_NAMESPACE
class SwitchButton;
class MainWindow : public Dtk::Widget::DMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void addWindow(QString itemName, QIcon icon = QIcon(), QWidget *window = new QWidget);

private:
    void login();
    void paintEvent(QPaintEvent *event);
    void initMember();
    void initWidget();

public Q_SLOTS:
    void slot_iconBtnClicked();
    void turnWindow(const QModelIndex &index); //DListView点击槽

protected:
    virtual void closeEvent(QCloseEvent *event) override;

private:
    Dtk::Widget::DIconButton *m_icon;
    QVector<SwitchButton *> m_btnVec;

    bool m_isRegister;
    QString m_phoneNumber;

    QStandardItemModel *m_leftLstMod;
    QHBoxLayout *m_rightLayout;

    QList<QWidget *> m_rightWidgetLst;
    QList<QWidget *> m_rightWidgetLstOnShow;
    QWidget *m_switchView; //DlistView的页面1
    QWidget *m_baseBtnView; //DlistView的页面1
};

#endif // MAINWINDOW_H
